home *** CD-ROM | disk | FTP | other *** search
- /********************************/
- /* File: FIleOpen.c */
- /* */
- /* open the file whose name and */
- /* working directory id are */
- /* passed as parameters. This */
- /* information can be obtained */
- /* using GetFileNameToLoad... */
- /* */
- /* Paramters: */
- /* param0 = file name num */
- /* param1 = directory id */
- /* */
- /* Out: */
- /* File RefNum if opened, 0 */
- /* otherwise */
- /* ---------------------------- */
- /********************************/
-
- #include <MacTypes.h>
- #include <OSUtil.h>
- #include <MemoryMgr.h>
- #include <FileMgr.h>
- #include <ResourceMgr.h>
- #include <pascal.h>
- #include <strings.h>
- #include "HyperXCmd.h"
- #include "HyperUtils.h"
-
-
- pascal void main( paramPtr )
- XCmdBlockPtr paramPtr;
- {
- char *filename;
- Str31 str, fName;
- short wdid, refnum;
-
- HLock( paramPtr->params[0] );
- ZeroToPas( paramPtr, *(paramPtr->params[0]), &fName );
- HUnlock( paramPtr->params[0] );
-
- /* convert the wdid to a usable form */
- HLock( paramPtr->params[1] );
- ZeroToPas( paramPtr, *(paramPtr->params[1]), &str );
- HUnlock( paramPtr->params[1] );
- wdid = (short)StrToNum( paramPtr, &str );
-
- if( FSOpen( &fName, wdid, &refnum) == noErr )
- NumToStr( paramPtr, (long)refnum, &str );
- else
- NumToStr( paramPtr, 0L, &str );
-
- paramPtr->returnValue = PasToZero( paramPtr, &str );
- }
-
-